
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>注册</title>
    <script type="text/javascript">
	// 创建用户
	function addUser() {

	$.post("${pageContext.request.contextPath}/register.action",
			
	$("#contact-form").serialize(),function(data){
	        if(data =="OK"){
	            alert("用户创建成功！");
	            window.location.reload();
	        }else{
	            alert("用户创建失败！");
	            window.location.reload();
	        }
	        
	    });
	}
    </script>
</head>

<body>
<section id="content"><div class="ic"></div>


       <div class="box-contact">
        <h3>欢迎注册成为厨师</h3>
        <form id="contact-form"   >
            <div class="success"> 注册! <strong>注册成功.</strong> </div>
            <fieldset>
                <div class="coll-1">
                    <div>
                        <div class="form-txt">用户名(账号):</div>
                        <label class="name">
                            <input type="text" class="form-control" id="username"
                                   name="username" required="required">
                            <span class="error">*非法用户名.</span> <span class="empty">*必填字段.</span> </label>
                        <div class="clear"></div>
                    </div>
                    <div>
                        <div class="form-txt">密码:</div>
                        <label class="name">
                            <input type="password" class="form-control" id="inputPassword"
                                   name="password" required="required">
                            <span class="error">*大于3位.</span> <span class="empty">*必填字段.</span> </label>
                        <input type="hidden" class="form-control" id="indent"
                               name="ident" value="1">
                        <div class="clear"></div>
                    </div>
                    <div>
                        <div class="form-txt">联系电话:</div>
                        <label class="phone">
                            <input type="tel" class="form-control" id="telephone"
                                   name="telephone" required="required">
                            <span class="error">*电话格式错误.</span> <span class="empty">*必填字段.</span> </label>
                        <div class="clear"></div>
                    </div>
                    <div>
                        <div class="form-txt">电子邮箱:</div>
                        <label class="email">
                            <input type="email" class="form-control" id="email"
                                   name="email" required="required">
                            <span class="error">*邮箱格式错误.</span> <span class="empty">*必填字段.</span> </label>
                        <div class="clear"></div>
                    </div>
                </div>
                <div class="coll-2">
                    <div>
                        <div class="form-txt">地址:</div>
                        <label class="message">
                            <input type="text" class="form-control" id="address"
                                   name="address" required="required">
                            <span class="error">*The message is too short.</span> <span class="empty">*This field is required.</span> </label>
                        <div class="clear"></div>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="btns">
                 <a type="button" class="btn btn-secondary"
                                           data-dismiss="modal" href="javascript:history.back();">返回</a> 
            <button type="button"class="btn btn-primary"  onclick="addUser()">注册</button> </div>
            </fieldset>
        </form>
    </div>
</section>

</body>
</html>
